instance object

The instance object is used to check whether a given game is already running.

instance(string application_name)

Parameters:
application_name
An optional unique name that is used internally for the game.

Remarks:
This object is useful if you wish to prevent multiple instances of the same game from being opened at the same time.

If the application_name argument is specified, it must be no more than 100 characters in length. If it is not specified, it will default to a hash of the game executable and hence will not work if trying to prevent an older version of a game from running alongside an updated copy.

Note: This class will only work if the game is compiled.

Example:
/*
Write a script that checks for another instance of itself. To make this script work effectively you must run it at least twice within ten seconds of the first instance being started.
*/

void main()
{
instance the_game("instance_checker");
if(the_game.is_already_running)
{
alert("Error", "This script is already running.");
exit();
}
wait(10000);
}